package anonymouschat.messages;

import anonymouschat.client.PublicIdentity;

/**
 * Returned to a client after it requests the public keys for another user.
 */
public class KeyResponse extends Message {

	private static final long serialVersionUID = 4975808951447190401L;
	/** Id of the user requested (This contains their public keys) */
	private PublicIdentity publicIdentity = null;
	private String userName = null;

	@Override
	public String getAllContents() {

		return "Contains public keys for " + userName;
	}
	
	public KeyResponse(PublicIdentity pubIdent) {
		this.publicIdentity = pubIdent;
		this.userName = this.publicIdentity.getUserName();
	}

	/**
	 * Empty key resp.
	 */
	public KeyResponse(String dstUserName) {
		this.publicIdentity = null;
		this.userName = dstUserName;
	}

	public String getUserName() {
		return userName;
	}

	public PublicIdentity getPublicIdentity() {
		return publicIdentity;
	}

}
